package spring.dao.ejemplos.tasks.dao.jdbc;

import java.util.List;

import javax.sql.DataSource;

import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;

import spring.dao.ejemplos.tasks.dao.TaskDAO;
import spring.dao.ejemplos.tasks.model.Task;

public class JDBCTemplateTaskDao implements TaskDAO {

	private SimpleJdbcTemplate jdbcTemplate;
	
	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new SimpleJdbcTemplate(dataSource);
	}
	
	
	public void addTask(Task task) {
		jdbcTemplate.update("INSERT INTO tasks (id, summary, completed, user) VALUES (?,?,?,?)", task.getId(), task.getSummary(), task.isComplete(),task.getUser());
	}

	public Task getTask(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Task> getTasks(String username) {
		// TODO Auto-generated method stub
		return null;
	}

	public void updateTask(Task task) {
		// TODO Auto-generated method stub

	}


	public void transferTask(String fromUser, String toUser, Task task) {
		// TODO Auto-generated method stub
		
	}

}